/**
 * 假设有如下字符串“A12”，其中“A”表示数据类型（A-Z），“12”表示数据序号（0-9）。
现在需要对一组数据  先按照数据序号  再按照数据类型进行排序。
例如：["B3","D2","F1","A9","D12","A2","C1","Z0","B1"]=>["Z0","B1","C1","F1","A2","D2","B3","A9","D12"]

分析：将数组传入函数中 若数组为空 退出
若不为空，sort() 字典顺序做类型排序
把各项的第一个字母截断，
 */

// 按数据序号排序
function sortByNumber(argArr) {
    if (!argArr || argArr.length === 0)
    return
    let numArr1 =[]
    let numArr2 =[]
        argArr.map(item => {
        let a = item.substring(1)
            if (Number(a) >= 0 && Number(a) < 10) {
                
                numArr1.push(a)
            } else {
                numArr2.push(a)
        }
        })
    let lastNumArr = numArr1.sort().concat(numArr2.sort())
    console.log('lastNumArr',lastNumArr);
}
//按数据类型排序
function sortByType(argArr) {
    if (!argArr || argArr.length === 0)
    return
    let typeArr = argArr.sort()
    console.log('typeArr',typeArr); 
}

let arr = ["B3","D2","F1","A9","D12","A2","C1","Z0","B1",'c19',"Y9"]
sortByNumber(arr)
// sortByType(arr)  // ['A2', 'A9', 'B1', 'B3', 'C1', 'D12','D2','F1',"Y9", 'Z0' ]